<template>
  <div class="earn-integral">
        <button
            class="buy-btn theme-customize-bg"
            @click="jumpLookBenefits"
          >
            {{ btnText }}
          </button>
  </div>
</template>

<script>
import locale from '../../../../mixins/locale'
export default {
  props: {
    orderInfo: {
      type: Object,
      default: {},
    },
    btnText:{
      type: String,
      default: '',
    }
  },
  data() {
    return {
      
    };
  },
  mixins: [locale],
  methods: {
    // 查看有价优惠券权益
    jumpLookBenefits() {
        // 有价优惠券
        let rightsUrl = ''
        //valued_coupon_state 1-跳转到有价优惠券列表
        if(this.orderInfo.valued_coupon_state === 0){
            if (this.orderInfo.coupon_type === 1) {
                rightsUrl = '/coupon/my_coupons';
            } else if (this.orderInfo.coupon_type === 2) {
                rightsUrl = `/v1/usercenter/order/rights/promo_code?order_id=${this.orderInfo.order_id}&resource_id=${this.orderInfo.resource_id}`;
            }
        } else {
            rightsUrl = `/v1/usercenter/order/coupon_list?order_id=${this.orderInfo.order_id}`
        }
        location.href = window.location.protocol + "//" + window.location.hostname  + rightsUrl;
    },
  },
};
</script>

<style lang="scss" scoped>
.earn-integral {
  width: 100%;
  margin: 0.32rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
    .buy-btn {
      width: 40%;
      height: .8rem;
      padding: 0.2rem;
      border-radius: 0.4rem;
      color: #ffffff;
    } 
}
</style>
